package com.niiwoo.civet.trade.service.refund;


import com.niiwoo.civet.trade.dto.common.BatchTransOrderDetailForAccountDTO;
import com.niiwoo.civet.trade.dto.common.RefundCallBackForAccountDTO;
import com.niiwoo.civet.trade.dto.common.TradeBatchTransOrderDTO;
import com.niiwoo.civet.trade.dto.request.myloan.ProjectRepaymentDTO;
import com.niiwoo.civet.trade.dto.response.myloan.BorrowerProjectAppResponseDTO;
import com.niiwoo.civet.trade.dto.response.myloan.ProjectrePaymentResponseDTO;
import com.niiwoo.civet.trade.dto.response.myloan.QueryRepaymentProjectSummaryDTO;
import com.niiwoo.civet.trade.dto.response.myloan.RefundGuideContentResponseDTO;

import java.util.List;
import java.util.Map;

/**
 * Created by fushengcai on 2017/11/6.
 */
public interface RepaymentDubboService {
    /**
     * 自动还款任务16:00,21:00(有代扣,无垫付)
     *
     * @param isWithHold 是否代扣
     */
    void repaymentBorrow(boolean isWithHold);

    /**
     * 日切
     */
    void autoCutDate();

    /**
     * 00：15分自动还款
     */
    void repaymentAutoRefundWithGuarantee();

    /**
     * 垫付
     * @param date
     * @param userId
     */
    void repaymentWithAutoGuarantee(String date, String userId);

    /**
     * web触发垫付入口
     * @param srcBatchNo
     */
    void testGuarantee(String srcBatchNo);

    /**
     * 还款分账（正常还款,逾期还款）
     */
    BatchTransOrderDetailForAccountDTO generateDetailForNormal(TradeBatchTransOrderDTO tradeBatchTransOrderDTO);

    /**
     * 提前结清分账
     * @param dto
     * @return
     */
    BatchTransOrderDetailForAccountDTO generateDetailForOverDebt(TradeBatchTransOrderDTO dto);



    /**
     * 还款回调入口（账户中心-》交易中心）
     * @param dto
     */
    void repaymentCallBackForAccountNew(List<RefundCallBackForAccountDTO> dto);


    /**
     * web还款入口
     * @param dto
     * @return
     */
    BorrowerProjectAppResponseDTO webRepayment(ProjectRepaymentDTO dto);


    /**
     * 查询还款标的摘要信息
     * @param projectId
     * @return
     */
    QueryRepaymentProjectSummaryDTO getRepaymentProjectSummary(Long projectId);




    /**
     * 根据用户id和项目id集合查询还款计划
     * @param borrowerUserIdProjectIdDTO map<borrowerUserId，projectId>
     * @return
     */
    List<ProjectrePaymentResponseDTO> getProjectRepaymentForProjectIdList(List<Map<String,Long>> borrowerUserIdProjectIdDTO);

    /**
     * 1待处理，2成功，3失败
     * @param batchRequestNo
     * @return
     */
    int queryRefundStatusByBatchRequestNo(String batchRequestNo);

    /**
     * 还款成功引导
     * @return
     */
    RefundGuideContentResponseDTO refundGuideContent(String userId);

    /**
     * 立即还款检查
     * @param projectId
     */
    void checkRepaymentByProjectId(Long projectId);

    /**
     * 更新还款计划表罚息
     */
    void updatePenaltyFeeForPlan();

    /**
     * 更新还款订单状态
     * @param requestNo
     * @return
     */
    int updateTransOrderToFailed(String requestNo);

    /**
     * Job同步账户中心还款订单失败状态（仅同步失败）
     */
    void updateTransOrderToFailedForJob();

    /**
     * 还款提醒定时任务
     */
    void sendRepaymentRemindMessageForJob();

    /**
     * 还款逾期定时任务
     */
    void sendRepaymentOverdueMessageForJob();

    /**
     * 根据标的id和用户id查询还款计划列表
     */
    List<ProjectrePaymentResponseDTO> listRepaymentPlanByProjectIdAndUserId(Long projectId, String userId);

    /**
     * 查询当前逾期标的数
     * @param userId
     * @return
     */
    Integer countOverdueProject(String userId);

    /**
     * 30天以上还款逾期标的
     * @param userId
     * @param exceedDays
     * @return
     */
    Integer selectOverdueExceedConditionRepayment(String userId,Integer exceedDays);

    /**
     * 补发投资加息券
     * @param projectIds
     */
//    void useInterestRatePrize(String projectIds);

}
